'use strict';

module.exports = function collectSameElements(collectionA, objectB) {
  let result = [];
  for(let item of collectionA){
    if(ChoosetheSameA(objectB,item)){
      result.push(item);
    }
  }
  return result;
}

function ChoosetheSameA(obj,i){
  for (let a in obj){
    for(let item of obj[a]){
      if(item == i){
        return true;
      }
    }
  }
  return false;
}